# Reference: <https://postmarketos.org/devicepkg>
pkgname=device-xiaomi-pine
pkgdesc="Xiaomi Redmi 7A"
pkgver=2
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
	linux-xiaomi-pine
	mkbootimg
	postmarketos-base
"
makedepends="devicepkg-dev"
source="
	deviceinfo
	etc-lightdm-lightdm.conf
"

subpackages="
	$pkgname-nonfree-firmware:nonfree_firmware
	$pkgname-fix-lightdm:fix_lightdm
"

build() {
	devicepkg_build $startdir $pkgname
}

package() {
	devicepkg_package $startdir $pkgname
}

nonfree_firmware() {
	pkgdesc="Proprietary firmware"
	depends="firmware-xiaomi-pine"
	mkdir "$subpkgdir"
}

# copied from device-samsung-goyawifi
fix_lightdm() {
	install_if="$pkgname lightdm"
	pkgdesc="Fix the problem for CanGraphical=no in LightDM according to Display Manager in PMOS Wiki"
	depends="lightdm"
	replaces="lightdm"

	# Install lightdm configuration with logind-check-graphical=false
	install -D -m644 "$srcdir"/etc-lightdm-lightdm.conf \
		"$subpkgdir"/etc/lightdm/lightdm.conf
}
sha512sums="
a61f1d0205fd478c76954ef4785e685dcad493287f5569c227e4f05a00cc4243342a9a7e4e800438584340e44bf05231548d261e96e83bba62f354207b0760cd  deviceinfo
861270c6bc0b2a3e6cd389c21c8c895e62de8cf8bec6fcf23c178f8cbaae855d62b0ee98692671ab4f518d84cb43dd0b2fe46f5a609f65af6a6c06e0fdbb6d0c  etc-lightdm-lightdm.conf
"
